package com.xin.data.simbapesa.device.data

import android.content.Context
import com.google.gson.Gson
import com.xin.data.simbapesa.base.BaseParams
import com.xin.data.simbapesa.device.util.StorageUtil
import com.xin.data.simbapesa.device.util.gzipString
import com.xin.data.simbapesa.utils.LogUtil


class RamInfo(val context: Context) {

    fun fetch(): String? {
        return try {
            val data = HashMap<String, Any>().apply {
                put("imei", "")
                put("containSd", StorageUtil.getContainSD())
                put("ramCanUse", StorageUtil.getRamCanUse(context))
                put("ramTotal", StorageUtil.getRamTotal(context))
                put("cashCanUse", StorageUtil.getCashCanUse())
                put("cashTotal", StorageUtil.getCashTotal())
                put("extraSD", StorageUtil.getExtraSD())
                put("internalTotal", StorageUtil.getTotalInternalStoreSize(context))
                put("internalAvailable", StorageUtil.getAvailaInternalStoreSize(context))
                put("ramDidUsed", StorageUtil.getRamDidUsed(context))
                put("cashDidUsed", StorageUtil.getCashDidUsed())
                put("sdCardTotal", StorageUtil.getSDCardTotal())
                put("version", BaseParams.getVersion(context))
            }
            LogUtil.e("me", "RamInfo data->$data")
            Gson().toJson(data).trim().gzipString()

        } catch (e: java.lang.Exception) {
            null
        }
    }
}